Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of the crate includes defined there events #1842

Merged

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Jul 6, 2023

The PR shows that including any code from the crate also imports all defined there events. We discussed about the potential solution during previous PR=)

@xgreenx xgreenx mentioned this pull request Jul 6, 2023
Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment #1827 (comment).

If you agree, could you change this PR to demonstrate that an event defined in a dependency, which is not explicitly used, but other code in the crate is used, is expected to be included in the metadata?

This way the test is proving what our expected behaviour is.

@xgreenx xgreenx force-pushed the bug/shared-event-gather-not-used-events branch from 75dc7f5 to d0aa0b1 Compare July 13, 2023 18:51
@ascjones ascjones merged commit 1a8b157 into aj/shared-events-redux Jul 14, 2023
@ascjones ascjones deleted the bug/shared-event-gather-not-used-events branch July 14, 2023 09:24
ascjones added a commit that referenced this pull request Jul 24, 2023
* WIP derive Event

* Move tests to top level

* Add failing Event derive test

* Test compiles, now fails

* Passing test, now impl

* Passing test with no fields

* Add events integration-tests example

* Expose Event derive macro at the top level ::ink::Event

* Remove println!

* Remove ContractEventBase

* WIP rewiring event codegen for use with derive.

* Direct impl of emit_event

* Use bound_impl

* WIP impl derive EventMetadata

* WIP add event metadata derive

* Add some metadata derive todos

* WIP Collect metadata from linked events

* Refactor event metadata collection

* Add metadata test

* Check for external and Inline events

* Add todo for inline events

* WIP adding compile time topics check to emit_event.

* fmt

* Refactor EventRespectsTopicsLimit to use const assertion

* Fmt

* Remove unused code from legacy events generation

* test and generate SIGNATURE topic

* use built in ink macro for generating signature topic

* Remove all warnings

* Implement anonymous event

* Remove PrefixedValue

* Implement field topics

* Use TOPICS_LEN for topics remaining

* WIP don't push Option::None topics

* Fix only publishing if not `Option::None`

* Fix only publishing if not `Option::None`

* Only publish value of `Some` topic, not none.

* Fix event derive codegen tests

* Add test for None topic

* Rename Topics trait to Event

* Fmt

* Remove println

* Remove EmitEvent imports

* WIP adding E2E test for topics

* Clippy

* Unnused imports

* E2E test contract events emitted

* WIP e2e testing topics

* Add e2e test which checks topics

* Add signature topic to event spec metadata

* Use Result in EventMetadata derive

* Tests for generating events metadata

* Remove max topics len compile time check

* Add failing test for topics len validation at metadata generation time

* Check for max topics limit breach in metadata generation

* Add extra event with no signature topic

* Remove checks for generics and pub visibility

* Fix anonymous attr

* Move topics attr validation to derive macro

* Fmt and remove remaining MAX_TOPICS check

* Remove event spec field type name

* Clippy

* WIP add `#[ink::event]` which expands to derives

* Check for signature topics collisions when building metadata

* Commentl

* Remove EventRespectsTopicLimits

* Remove cfg attr test

* Remove unused topics attr test

* Fmt

* Fix trait erc20 tests

* Fix erc20 tests and fmt

* Fix duplicate inline attrs. Remove offchain duplicate topics check.

* Fmt

* Clippy

* clippy

* events clippy

* Push 0 topic if `None`

* Expose signature_topic

* Change SignatureTopic to expose as_bytes

* Add test for None topic value

* Fix erc20 topic tests

* Add module_path

* Fix max topics in tests

* Fix event docs test

* Clippy

* Use path dependency for ink_env

* Remove ink_env dependency

* RUSTFLAGS for test to fix linking issue

* RUSTFLAGS for test to fix linking issue

* Fix custom environment, remove extra topic

* Use ink::event syntax

* Add ui test for cfg attributes

* Add success ui tests for ink::event

* UI test for `enum` should fail

* Refactor topic attribute fn to accept BindingInfo

* Fmt

* Remove commented out code

* Event docs

* Add event field docs

* Fix event param spec doc tests

* Fix metadata codegen tests

* Implement docs for `Event` derive macro

* Spellcheck

* Check for multiple ink attributes

* Spellcheck

* Ink attribute validation

* Remove Topic

* Oops

* Oops again

* Test for events in different crates being used in the metadata.

* Test for unused event not included in metadata

* Add test for inline event definition metadata.

* Add test for emitting inline event

* Fmt

* Remove todo, duplicate attributes are checked in the derive impls

* Add docs

* Fix examples-test

* Add docs for `#[ink::event]`

* Add docs for `EventMetadata` trait

* Update Event trait comments

* Docs

* SIGNATURE_TOPIC docs

* Fix docs

* fmt

* Try setting lto = "thin" for metadata crate to fix met

* Add lto to test profile of unit test

* Add test to check disallow generics for Event derive

* Fmt

* Change to `#[ink::event(anonymous = true)]` syntax

* Fix test

* Annotate derived event struct with anon

* UI test

* Document limitation of signature topic derive

* Fix doctest

* Fix up errors after merge

* Usage of the crate includes defined there events (#1842)

* Usage of the crate includes defined there events

* Inclusion of the event from `event_def_unused` is expected

* Update anonymous syntax

* Anonymous comment

* Move haashing macro inline signature topic gen fn

* Fix signature_topic return type

---------

Co-authored-by: Green Baneling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants